package com.funny.stock.backtest.controller;

import com.funny.stock.backtest.service.BackTestPlanService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author pengl
 * @date 2020/05/17
 **/
@RestController
@RequestMapping("/backtest/plan")
public class BackTestPlanController {
    public static final Logger logger = LoggerFactory.getLogger(BackTestPlanController.class);


    @Autowired
    HttpSession httpSession;

//    @Autowired
//    StockDataService stockDataService;

    @Autowired
    BackTestPlanService planService;

//    @PostMapping("/start")
//    public Result<BackTestPlanVO> start(@RequestBody BackTestPlanVO dataObj){
//        Long userId = UserSecurityUtil.getUserId(httpSession);
//
//        dataObj.setCreateId(userId);
//        dataObj.setCreateDate(new Date());
//        dataObj.setUpdateId(userId);
//        dataObj.setUpdateDate(new Date());
//
//        StockDO stock = stockDataService.getStockByCode(dataObj.getStockCode());
//
//        if(stock == null)
//            return ResultUtil.error("股票不存在");
//
//
////        if(dataObj.getInitBalance() == null)
////            return ResultUtil.error("金额数据为空");
//        BackTestPlanVO planVO = planService.startBackTest(dataObj);
//
//        return ResultUtil.success(planVO);
//    }
//
//    @GetMapping("/{id}")
//    public Result<ComposeAssetsActionVO> detail(@PathVariable Long id){
//        Long userId = UserSecurityUtil.getUserId(httpSession);
//        ComposeAssetsActionVO detailVO = actionService.findByCreateIdAndId(userId,id);
//        return ResultUtil.success(detailVO);
//    }
//
//    @GetMapping("/listByPage")
//    public Result<Page<ComposeAssetsActionVO>> listByPage(@RequestParam(defaultValue = "1") Integer pageNum,
//                                                     @RequestParam(defaultValue = "20") Integer pageSize){
//
//        Page<ComposeAssetsActionVO> page = actionService.findAll(PageUtil.buildPageRequest(pageNum, pageSize));
//        return ResultUtil.success(page);
//    }
//
//
//    @PostMapping("/queryByPage")
//    public Result<Page<ComposeAssetsActionVO>> myListByPage(@RequestParam(defaultValue = "1") Integer pageNum,
//                                                       @RequestParam(defaultValue = "20") Integer pageSize,
//                                                       @RequestBody ComposeAssetsActionVO queryVO){
//
//        Long userId = UserSecurityUtil.getUserId(httpSession);
//        queryVO.setCreateId(userId);
//
//        Page<ComposeAssetsActionVO> page = actionService.queryByCondition(queryVO,pageNum, pageSize);
//        return ResultUtil.success(page);
//    }

}
